<extend name="Index/index" />
<block name="center">
<div class="panel panel-blue">
    <div class="panel-heading">用户修改</div>
        <div class="panel-body pan">
                <form action="{:U('Admin/User/update')}" class="form-horizontal" method="post">
                    <div class="form-actions top">
                        
                    </div>
                    <div class="form-body pal">
                        <div class="form-group">
                            <label for="inputAddress" class="col-md-3 control-label">用户名称 <span class="require">*</span>
                            </label>
                            <div class="col-md-9">
                                <div class="input-icon right" ><i class="fa fa-location-arrow"></i>
                                    <div style="float:left"><input type="text"  class="form-control" name="username" id="User" style="width:300px" value="{$info['0']['username']}" placeholder="请输入6-18位的字母数字下划线"></div><div style="float:left; margin-top:10px;" error="请输入6-18字母数字下划线" id="usererror"></div>
                                </div>
                            </div>
                        </div>
                          <div class="form-group">
                            <label for="inputAddress" class="col-md-3 control-label">邮箱 <span class="require">*</span>
                            </label>
                            <div class="col-md-9">
                                <div class="input-icon right" ><i class="fa fa-location-arrow"></i>
                                    <div style="float:left"><input type="text" class="form-control" name="email" id="Emaill" style="width:300px" value="{$info[0]['email']}" placeholder="请输入正确的邮箱格式"></div><div style="float:left; margin-top:10px;" error="邮箱格式输入错误" id="emailerror"></div>
                                </div>
                            </div>
                        </div>  <div class="form-group">
                            <label for="inputAddress" class="col-md-3 control-label">地址 <span class="require">*</span>
                            </label>
                            <div class="col-md-9">
                                <div class="input-icon right" ><i class="fa fa-location-arrow"></i>
                                    <div style="float:left"><input type="text"  class="form-control" name="address" id="Address" style="width:300px" value="{$info[0]['address']}" placeholder="请输入正确的地址"></div><div style="float:left; margin-top:10px;" error="地址格式输入错误" id="addresserror"></div>
                                </div>
                            </div>
                        </div>
                          <div class="form-group">
                            <label for="inputAddress" class="col-md-3 control-label">联系方式<span class="require">*</span>
                            </label>
                            <div class="col-md-9">
                                <div class="input-icon right" ><i class="fa fa-location-arrow"></i>
                                    <div style="float:left"><input type="text"  class="form-control" name="phone" id="Phone" style="width:300px" value="{$info[0]['phone']}" placeholder="请输入正确的手机号"></div><div style="float:left;margin-top:10px;" error="手机号格式错误" id="phoneerror"></div>
                                </div>
                            </div>
                        </div>
                         <div class="form-group">
                            <label for="inputAddress" class="col-md-3 control-label">订餐状态<span class="require">*</span>
                            </label>
                            <div class="col-md-9">
                                <div class="input-icon right" ><i class="fa fa-location-arrow"></i>
                                    <div style="float:left"><select class="form-control" name="status" style="width:300px">
                                        <option value="0" <if condition="$info['0']['status'] eq '0'"> selected</if>>否</option>
                                        <option value="1" <if condition="$info['0']['status'] eq '1'"> selected</if> >是</option>
                                    </select></div><div style="float:left"></div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="form-actions">
                        <div class="col-md-offset-3 col-md-9">
                            <input type="hidden" name="uid" value="{$info['0']['id']}">
                            <input type="hidden" name="id" value="{$info['0']['id']}">
                            <input type="submit" value="提交" class="btn btn-primary">&nbsp;
                            <button type="reset" class="btn btn-green">重置</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
      <script type="text/javascript" src="__PUBLIC__/js/jquery-1.8.3.min.js"></script>

<script type="text/javascript">
$(function(){
    var statu = false;
    //判断用户名
    $('#User').blur(function(){
        //获取值
        var v = $(this).val();
        var reg = /^\w{6,18}$/;
        var res = reg.test(v);
        // alert(v);
        if(!res){
            $(this).css('border','1px solid red');
            //获取值
            var fv = $('#usererror').attr('error');
            $('#usererror').html(fv).css('color','red');
            statu = false;
        }else{
            $(this).css('border','1px solid green');
            $('#usererror').html('√').css('color','green');

            statu = true;
        }
    })

    // 判断邮箱
    $('#Emaill').blur(function(){
        //获取值
        var v = $(this).val();
        var reg = /^([a-z0-9_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})$/;
        var res = reg.test(v);
        // alert(v);
        if(!res){
            $(this).css('border','1px solid red');
            //获取值
            var fv = $('#emailerror').attr('error');
            $('#emailerror').html(fv).css('color','red');
            statu = false;
        }else{
            $(this).css('border','1px solid green');
            $('#emailerror').html('√').css('color','green');

            statu = true;
        }
    })
    //判断地址
    $('#Address').blur(function(){
        //获取值
        var v = $(this).val();
        
        // alert(v);
        if(v == ''){
            $(this).css('border','1px solid red');
            //获取值
            var fv = $('#addresserror').attr('error');
            $('#addresserror').html(fv).css('color','red');
            statu = false;
        }else{
            $(this).css('border','1px solid green');
            $('#addresserror').html('√').css('color','green');

            statu = true;
        }
    })

        //判段手机号
    $('#Phone').blur(function(){
        //获取值
        var v = $(this).val();
        var reg = /^1\d{10}$/;
        var res = reg.test(v);
        // alert(v);
        if(!res){
            $(this).css('border','1px solid red');
            //获取值
            var fv = $('#phoneerror').attr('error');
            $('#phoneerror').html(fv).css('color','red');
            statu = false;
        }else{
            $(this).css('border','1px solid green');
            $('#phoneerror').html('√').css('color','green');

            statu = true;
        }
    })



    $('form').submit(function(){
        $('#User').trigger('blur');
        $('#Address').trigger('blur');
        $('#Phone').trigger('blur');
        $('#Emaill').trigger('blur');
        if(statu){
            return true
        }else{
            return false;
        }
    })
})

    
</script> 

</block>